import os, sys
def rel(*x):
	return os.path.join(os.path.abspath(os.path.dirname(__file__)), *x)
RUNNING_ON_EPIO = True if os.environ.get('RUNNING_ON_EPIO') is '1' else False

DEBUG = TEMPLATE_DEBUG = not RUNNING_ON_EPIO
#TEMPLATE_DEBUG = not RUNNING_ON_EPIO

ADMINS = (
    ('Dan Palmer', 'dan.palmer@me.com'),
    ('Patrick Naish', 'patrick@pmnaish.co.uk')
)

MANAGERS = ADMINS

if DEBUG:
	DATABASES = {
	    'default': {
	        'ENGINE': 'django.db.backends.sqlite3',
	        'NAME': 'testing.db',
	    }
	}
# Settings for production database added by ep.io

TIME_ZONE = 'Europe/London'
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
USE_I18N = False
USE_L10N = True

if DEBUG:
	ROOT_URL = 'http://10.30.200.37:8000/'
else:
	ROOT_URL = 'http://intr.ep.io/'

MEDIA_ROOT = rel('static')
MEDIA_URL = ROOT_URL + 'static/'
ADMIN_MEDIA_ROOT = rel('grappelli/static')
ADMIN_MEDIA_PREFIX = MEDIA_URL + 'admin/'
STATIC_FILES_ROOT = rel('static')


STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)

SECRET_KEY = 't0n-jxxh1v6a8yw*dnap+w#ocyzc8)mf5v^9d6!j00$70=30(p'

TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
)

TEMPLATE_CONTEXT_PROCESSORS = (
    'django.contrib.auth.context_processors.auth',
    'django.core.context_processors.request',
    'django.core.context_processors.i18n',
    'django.contrib.messages.context_processors.messages',
    
	'intr.context_processors.processors.settings',

)

ROOT_URLCONF = 'intr.urls'

TEMPLATE_DIRS = (
    rel('templates'),
)

GRAPPELLI_INDEX_DASHBOARD = 'dashboard.CustomIndexDashboard'

INSTALLED_APPS = (
	'grappelli.dashboard',
	'grappelli',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.admin',
    'django.contrib.admindocs',

	'intr.models',
	'intr.accounts',
	'intr.societies',
	'intr.events',
	'intr.blog',
)

AUTH_PROFILE_MODULE = 'intr.models.models.UserProfile'
LOGIN_URL = '/accounts/login'

INSTALLATION_SETTINGS = {
	'location_name':'University of Southampton',
	'site_name':'SUSU Societies',
}

# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'class': 'django.utils.log.AdminEmailHandler'
        }
    },
    'loggers': {
        'django.request': {
            'handlers': ['mail_admins'],
            'level': 'ERROR',
            'propagate': True,
        },
    }
}

# DJANGO-DEBUG-TOOLBAR
USE_DEBUG_TOOLBAR = False
if USE_DEBUG_TOOLBAR:
	INTERNAL_IPS = ('127.0.0.1',)
	MIDDLEWARE_CLASSES += (
		'debug_toolbar.middleware.DebugToolbarMiddleware',
	)
	INSTALLED_APPS += (
		'debug_toolbar',
	)
	#DEBUG_TOOLBAR_CONFIG = {'INTERCEPT_REDIRECTS':False}
